<template>
	<view class="custom">
		<view class="block search-block"
			:style="'height:'+(custom.navHeight)+'rpx;width:calc(100% - '+(custom.navWidth+custom.navMarRight)+'rpx);margin-top:'+(custom.statusBar+custom.nvaMartom)+'rpx'">
			<view v-if="isBack" @click="backup" class="iconfont icon-zuojiantou backup-btn"></view>
			<view style="height:100%" class="search">
				<view class="icon-sousuo iconfont"></view>
				<input @blur="getInput" :value="keyword" class="search-input" placeholder="搜索地点/美食/酒店/民宿等"
					placeholder-style="color:#606266" />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			custom: Object,
			isBack: Boolean,
		},
		data() {
			return {
				keyword: ''
			}
		},
		methods: {
			backup() {
				uni.navigateBack();
			},
			getInput(e) {
				uni.$emit('getSearchInput', e.detail.value);

			}
		}
	}
</script>

<style lang="scss" scoped>
	.custom {
		.search-block {
			display: flex;
			align-items: center;

			.search {
				flex-grow: 1;
				display: flex;
				align-items: center;
				margin: 0 20rpx;
				background: rgba(255, 255, 255, 0.8);
				color: $color-regular-text;
				padding: 0 20rpx;
				font-size: 24rpx;
				border-radius: 60rpx;
				position: relative;

				.search-input {
					flex-grow: 1;
				}

				.iconfont {
					flex-grow: 0;
					margin-right: 10rpx;
				}
			}

			.iconfont.backup-btn {
				display: flex;
				align-items: center;
				flex-grow: 0;
				margin-left: 20rpx;
				color: #fff;
				font-size: 36rpx;
			}
		}
	}
</style>
